package com.itlong.cloud.smartcard;

import com.itlong.cloud.equip.property.IPropertyDeviceAuthServiceClient;
import com.itlong.cloud.utils.date.DateUtil;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RestController;

import java.util.*;

/**
 * <desc>
 *      与一卡通人脸识别系统增量同步数据的定时任务
 * </desc>
 *
 * @createDate 2019-07-06
 */
@EnableScheduling // 启用定时任务
@RestController
public class SmartCardFacePullDataTimedTask {

    private static Logger LOG = LoggerFactory.getLogger(SmartCardFacePullDataTimedTask.class);

    @Autowired
    IPropertyDeviceAuthServiceClient iPropertyDeviceAuthServiceClient;  //用户设备权限操作对象

    /**
     * <desc>
     *      与一卡通人脸识别系统增量同步数据的定时任务
     * <desc/>
     *
     * @param
     * @return
     * @author Juguang.S
     * @createDate 2019/07/06
     */
    @Scheduled(cron = "0/15 * * * * ?") // 每15秒执行一次
    public void timeTaskPushCloudEntrance() {
        try {
            iPropertyDeviceAuthServiceClient.timeTaskPushSamrtCardFace();
//            LOG.info("【定时任务】与一卡通人脸识别系统增量同步数据的定时任务执行成功，当前时间：" + DateUtil.format(Calendar.getInstance(), "yyyy-MM-dd HH:mm:ss"));
        }catch (Exception e){
            LOG.error("【定时任务】与一卡通人脸识别系统增量同步数据的定时任务执行失败，当前时间：" + DateUtil.format(Calendar.getInstance(), "yyyy-MM-dd HH:mm:ss:"),e);
        }
    }

}
